package mapred.example;

import java.io.IOException;

import mapred.base.TextMapper;
import mapred.example.model.Index;

import org.apache.hadoop.io.Text;

public abstract class IndexReader extends TextMapper {

    private Index index = new Index();

    @Override
    public void map(Text key, Text value) throws IOException {
        index.addField(key.toString(), value.toString());
        if (index.ready()) {
            map(index);
        }
    }

    public abstract void map(Index index) throws IOException;

}
